package StudyCode.summary.myfile;

import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class DeleteTemporaryFileWithDeleteOnExit {
	public static void main(String[] args) throws IOException, InterruptedException {
		Path basedir = FileSystems.getDefault().getPath("E:/Copy/");
		String tmp_file_prefix = "test_";
		String tmp_file_sufix = ".txt";

		Path tmp_file = Files.createTempFile(basedir, tmp_file_prefix, tmp_file_sufix);

		File asFile = tmp_file.toFile();
		asFile.deleteOnExit();

		Thread.sleep(1000);
	}
}
